Crate bevy_audio
source ·Expand description
Audio support for the game engine Bevy
fn main() {
App::new()
.add_plugins(MinimalPlugins)
.add_plugin(AssetPlugin::default())
.add_plugin(AudioPlugin)
.add_startup_system(play_background_audio)
.run();
}
fn play_background_audio(asset_server: Res<AssetServer>, audio: Res<Audio>) {
audio.play(asset_server.load("background_audio.ogg"));
}
Modules
Structs
- Use this
Resource
to play audio. - Loads files as
AudioSource
Assets
- Used internally to play audio on the current “audio device”
- Adds support for audio playback to a Bevy Application
- Asset controlling the playback of a sound
- A source of audio data
- Settings to control playback from the start.
- Asset controlling the playback of a sound, or the locations of its listener and emitter.
Traits
- Common interactions with an audio sink.
- A trait for working generically across different Sample format types.
- A type implementing this trait can be converted to a
rodio::Source
type. It must beSend
andSync
, and usually implementsAsset
so needs to beTypeUuid
, in order to be registered. Types that implement this trait usually contain raw sound data that can be converted into an iterator of samples. This trait is implemented forAudioSource
. Check the exampleaudio/decodable
for how to implement this trait on a custom type. - Represents a value of a single sample.
- A source of samples.
Functions
- Plays audio currently queued in the
Audio
resource through theAudioOutput
resource